package com.example.oasystem.dao.attend;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.oasystem.entity.attend.AoaAttendsList;
import com.example.oasystem.entity.status.AoaStatusList;
import com.example.oasystem.entity.type.AoaTypeList;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Mapper
@Repository
public interface AoaAttendsListDao extends BaseMapper<AoaAttendsList> {
    List<AoaAttendsList> selectAllByNameAndDept(String deptid);
    List<AoaAttendsList> selectAllByNameAndDeptAndName(String deptid,String baseKey);
    List<AoaAttendsList> selectAllByNameAndDeptAndNameAndOrder(String deptid,String baseKey,Integer type,Integer time,Integer status,String order);
    @Select("select * from aoa_attends_list where attends_id=#{attendsId}")
    AoaAttendsList findOne(int attendsId);
    @Select("SELECT * from aoa_status_list where status_id=11 or status_id=12 or status_id =10 ")
    List<AoaStatusList> findAttendsStatus();
    @Update("update aoa_attends_list set attends_remark=#{remark},status_id=#{statusId} where attends_id=#{id}")
    int updateAttends(@Param("id")int id, @Param("remark")String remark, @Param("statusId")int statusId);
    @Select("SELECT attends_id,attends_ip,attends_remark,attends_time,status_id,type_id,attends_user_id,attend_hmtime,week_ofday,holiday_days,holiday_start FROM aoa_attends_list WHERE attends_id=${aid}")
    AoaAttendsList selectByIdOnChen(String aid);
    int insertSelective(AoaAttendsList record);
    int updateByPrimaryKeySelective(AoaAttendsList record);
    @Select("select * from aoa_attends_list where attends_user_id = #{attendsUserId} and DATE(attends_time) = #{attendsTime}")
    List<AoaAttendsList> AoaAttendsList(@Param("attendsUserId")Long attendsUserId,@Param("attendsTime") String attendsTime);
    List<AoaAttendsList> aoaAttendsLists(@Param("attendsUserId") Long attendsUserId,@Param("attendsTime") String attendsTime);
    List<AoaAttendsList> aoaAttendsListPageSearch(@Param("attendsUserId") Long attendsUserId,@Param("attendsTime") String attendsTime,@Param("number")int number,@Param("size")int size);
    int updateStatusIdAndRemarkById(@Param("attendsRemark") String attendsRemark, @Param("statusId") long statusId, @Param("attendsId") long attendsId);
}